<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\FormVal;

/* @var $this yii\web\View */
/* @var $searchModel backend\modules\supplier\models\FactorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '厂家';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="factory-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('新建', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'name',
            'contacts',
            'mobile',
            // 'tel',
            [
                'attribute' => 'qq',
                'content' => function($data, $row) {
                    return Html::a($data->qq,"http://wpa.qq.com/msgrd?v=3&uin={$data->qq}&site=qq&menu=yes",['target'=>'hiddenIframe']);
                },
            ],
            // 'remark',
            [
                'attribute' => 'enable',
                'content' => function($data, $row) {
                    $typeMap=FormVal::$bool;
                    return $typeMap[$data->enable];
                },
            ],
            // 'address',
            // 'website',
            // 'email:email',
            // 'add_time:datetime',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>

<iframe id="hiddenIframe" name="hiddenIframe" style="display:none;"></iframe>